############## 下载git项目  #####################
FROM bitnami/git:2.34.0 as git-download
MAINTAINER biebbwa@163.com
ARG GITEE_HOME=https://gitee.com/moshowgame/SpringBootCodeGenerator.git
WORKDIR /
RUN git clone $GITEE_HOME

############## server-build 服务 #####################
FROM maven:3.8.4-openjdk-8 as build
MAINTAINER biebbwa@163.com
COPY --from=git-download /SpringBootCodeGenerator/ /app
COPY settings.xml /usr/share/maven/conf/settings.xml
RUN  cd /app && mvn package -T 1C -DskipTests -Dmaven.compile.fork=true

############## server #####################
FROM openjdk:8-jdk-slim as generator
MAINTAINER biebbwa@163.com
ENV JAR_NAME=generator-web-3.0.jar
ENV TZ=Asia/Shanghai
COPY --from=build /app/generator-web/target/${JAR_NAME} /app/
RUN  ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /app
EXPOSE 1234
ENTRYPOINT  java -jar ${JAR_NAME} ${JAVA_OPTS}






